<?php
/**
 *
 *
 */
abstract class Yz_Property_ReferenceList
    extends Yz_Property_Reference
    implements Yz_Property_Interface_ReferenceList
{


    /** Test if a value is suitable for the property, possibly adjust
     *      For a ReferenceList, a value must be a Yz_List of referenced model's objects
     *  @param mixed value
     *  @return the adjusted value
     *  @throw InvalidArgument
     */
    public function testValue($value)
    {
        $value = parent::testValue($value);
        if (null === $value)
            return null;
        if (! ($value instanceof Yz_Item_Interface)
                or ! $value->isItemOf($this->model))
            throw new Yz_Property_Exception("Value must be a valid object of {$this->model}");
        return $value;
    }



    /** Assign a value for an item from an array of values, with prefix
     *  @param string $propName
     *  @param array-type $values
     *  @param string $prefix
     *  @return value
     *  @throw Yz_Property_Exception
     */
    public function assignValue(Yz_Model_Interface $model, $propName, $values, $prefix)
    {
        return $this;
    }

}
